FBlockAllocator Class Reference

FBlockAllocator provides a simple allocator that works on larger blocks of memory. More...

#include <fmemory.h>

Public Member Functions

 FBlockAllocator (uint32 blockSize)
 Constructor.
 ~FBlockAllocator ()
 Destructor. Releases allocated memory back to the heap.
void * allocate (uint32 size)
 allocate memory from within a preallocated memory block. If size is larger than blockSize, blockSize is increased in multiples of 2.
void free (void *p)
 free memory allocated with allocate()

Protected Attributes

TArray< Block > blocks
uint32 blockSize
FLock lock

Detailed Description

FBlockAllocator provides a simple allocator that works on larger blocks of memory.

FBlockAllocator is used to allocate chunks of memory that are placed in larger memory blocks.

Memory is not released to the heap until the destructor of FBlockAllocator.

FBlockAllocator is thread safe, as it uses FLock to synchronize modifications.


Constructor & Destructor Documentation

FBlockAllocator ( uint32  blockSize  ) 

Constructor.

Parameters:
[in] blockSize : size of the memory blocks, that provide space for smaller allocations
~FBlockAllocator (  ) 

Destructor. Releases allocated memory back to the heap.


Member Function Documentation

void * allocate ( uint32  size  ) 

allocate memory from within a preallocated memory block. If size is larger than blockSize, blockSize is increased in multiples of 2.

void free ( void *  p  ) 

free memory allocated with allocate()


Field Documentation

TArray<Block> blocks [protected]
uint32 blockSize [protected]
FLock lock [protected]
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Empty

Copyright ©2013 Steinberg Media Technologies GmbH. All Rights Reserved.